<!doctype html>
<html lang="zh-CN" th:replace="web-layout :: layout(~{::title}, ~{::style}, ~{}, ~{::script}, ~{::body}, 'userExam')"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>我的考试</title>
    <style>

    </style>
    <script>
        $("#loadMore").click(function () {
            var pageNumber = parseInt($("#pageNumber").val()) + 1;
            dataList(pageNumber);
        })

        $(".btn-search").click(function () {
            dataList(1)
        })

        var main = $("#dataList");                     //主体元素
        function dataList(pageNumber) {
            $.post("/user/exam/child/list", {
                "name": $(".search-text").val(),
                "pageNumber": pageNumber
            }, function (result) {
                if (pageNumber == 1) {
                    main.html(result);
                } else {
                    main.append(result);
                }
                var pages = parseInt($("#pages").val());
                if (pages == pageNumber) {
                    $(".more").hide();
                }
            });
        }

        $(function () {
            dataList(1)
        })
    </script>
</head>
<body>
<div>
    <input type="hidden" value="0" id="pageNumber">
    <input type="hidden" value="0" id="pages">
    <div class="row" id="dataList">

    </div>
    <div class="row more fyl-mb20" style="display: none;">
        <div class="col-md-12">
            <div class="panel panel-default fyl-mb0 fyl-cp" id="loadMore">
                <div class="panel-body text-center fyl-p8">
                    加载更多
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>